<template>
    <div class="sysm-b-modu boxsi ml50 mr50" :style="'height: '+viewHeight+'px;'">
        <div class="sysm-bmodu-box">
            <div class="pl24 pr24 h100p">

                <table cellpadding="0" cellspacing="0" width="100%" class="sysm-bmbox-table">
                    <tbody><tr><td class="pb30" colspan="3"><h3>
                            出区登记
                        </h3></td></tr>
                    <tr>
                        <td width="300" rowspan="6" valign="top">
                            <div class="xxtbwel-t-user">
                                <img id="yyy" name="yyy" :src="showImgPath"  alt="" />
                            </div>
                        </td><td width="144" align="right" class="pr20">姓名：</td>
                        <td>{{user.loginName}}</td>
                    </tr>
                    <tr><td align="right" class="pr20">身份证号：</td>
                        <td>{{user.identityNo}}</td>
                    </tr>
                    <tr><td align="right" class="pr20">性别：</td><td>
                        {{user.sex}}
                        </td></tr>
                    <tr><td align="right" class="pr20">出区事由：</td>
                        <td>{{application.checkOutReason}}</td>
                    </tr>
                    <tr><td align="right" class="pr20">审批结果：</td>
                        <td>
                            <span v-if="application.applicationStatus=='0'" style="color:red;">未申请</span>
                            <span v-if="application.applicationStatus=='1'" style="color:red;">未审批</span>
                            <span v-if="application.applicationStatus=='2'">同意</span>
                            <span v-if="application.applicationStatus=='3'" style="color:red;">拒绝</span>
                        </td>
                    </tr>
                    <tr><td align="right" class="pr20">审批民警：</td>
                        <td>
                            {{application.updateUserName}}
                        </td>
                    </tr>
                </tbody></table>
                <div class="mt30 text_ac">
                    <a href="javascript:;" v-if="canOut" class="sysm-brbbom-btn true-obj mt10" 
                    @click="doSave()">确认并登记出区</a>
                </div>
            </div>
        </div>

    </div>
</template>

<script>
import {getShowImgPath} from '@/utils'
import {idcardreader} from '@/views/modules/webModu/terminal/js/kydevmonit'
export default {
    data(){
        return {
            viewHeight : 504,
            showImgPath:'',
            canOut:false,
            user:{},
            application:{},
            dataForm:{
                id:''
            }
        }
    },
    created(){
        this.showImgPath=getShowImgPath(this.vtp.get('imgPath'))
        var data = this.vtp.get('data');
        this.user=data.user;
        this.application=data.application;
        this.canOut=false;
        this.getDicItemNameSimple(this.user,'sex','sex','sex');
        if(this.application){
            this.getDicItemNameSimple(this.application,'checkOutReason','checkOutReason','checkOutReason');
            if(this.application.applicationStatus=='2'){
                this.canOut=true;
            }
            this.dataForm.id=this.application.checkInId;
        }else{
            this.application={
                applicationStatus:'0'
            }
        }
        console.log('this.application',this.application);
        
    },
    methods:{
        toRouter(o){
            this.vtp.toRouter(this,o);
        },
        doSave(){
            let takeOutPoliceId = this.vtp.get("takeOutPoliceId");
            let takeOutPoliceName = this.vtp.get("takeOutPoliceName");
            this.$http({
                url: this.$http.adornUrl(
                    "/zfuser/zfinvolvedregistration/doCqSave"
                ),
                method: "post",
                data: this.$http.adornData({
                    id:this.dataForm.id,
                    takeOutPoliceId:takeOutPoliceId,
                    takeOutPoliceName:takeOutPoliceName
                })
            }).then(({ data }) =>{
                if(data&&data.code==0){
                    this.toRouter('tjcg')
                }else{
                    this.$message.error("系统异常，提交失败");
                }
            })
            this.toRouter('tjcg');
        }
    },
    components:{
    },
    mounted(){
        this.viewHeight = this.vtp.winHei(166);
        window.onresize = function(){
            let pageHeiVal = tipLayout.winHei()-166;
            $('.sysm-b-modu').height(pageHeiVal);
        }
    }
}
</script>

<style>

</style>